


function [dataset_noothervote, consistent] = RationalizableVotes(  DATA )
 

global   choices %  ywill_  DATA_PREDICTION DATA_DPES2006


    DATA_NO_OTHERVOTE= zeros(choices+1,size(DATA,2),size(DATA,1)/choices);
for dd=1:size(DATA,1)/choices
    DATA_NO_OTHERVOTE(1:end-1,:,dd) = DATA((dd*choices)-choices+1:(dd*choices),:);
end

for dd=1:size(DATA,1)/choices
    for i = 1:choices
    if DATA_NO_OTHERVOTE(i,2,dd)==1 &&  DATA_NO_OTHERVOTE(i,3,dd)==max( DATA_NO_OTHERVOTE(:,3,dd))
       DATA_NO_OTHERVOTE(end,3,dd)=1;
    end
    end
    for i = 1:choices
    if DATA_NO_OTHERVOTE(i,2,dd)==1 &&  DATA_NO_OTHERVOTE(i,4,dd)==max( DATA_NO_OTHERVOTE(:,4,dd))
       DATA_NO_OTHERVOTE(end,4,dd)=1;
    end
    end    
    for i = 1:choices
    if DATA_NO_OTHERVOTE(i,2,dd)==1 &&  DATA_NO_OTHERVOTE(i,5,dd)==1
       DATA_NO_OTHERVOTE(end,5,dd)=1;
    end
    end     
end
consistentsincere    = sum(DATA_NO_OTHERVOTE(end,4,:))/ (size(DATA,1)/choices); % check it's the same as compatible_sincere
consistentcoalition  = sum(DATA_NO_OTHERVOTE(end,3,:))/ (size(DATA,1)/choices); % check it's the same as compatible_coalition
consistentfrontrunner= sum(DATA_NO_OTHERVOTE(end,5,:))/(size(DATA,1)/choices); % check it's the same as compatible_FRvoter

% consistent with how many types? let's add up the info at the bottom of
% the id column 
for dd=1:size(DATA,1)/choices
DATA_NO_OTHERVOTE(end,1,dd) = DATA_NO_OTHERVOTE(end,3,dd)+DATA_NO_OTHERVOTE(end,4,dd)+DATA_NO_OTHERVOTE(end,5,dd);
end

 
 aa = [];
% creating the dataset with no "other" votes 
for dd=1:size(DATA,1)/choices
    if DATA_NO_OTHERVOTE(end,1,dd)>0  % >  -1  % ~=0
    aa  = [aa; DATA_NO_OTHERVOTE(1:end-1,:,dd) ]  ;
    end
end
dataset_noothervote=aa;
consistent = [consistentsincere consistentcoalition consistentfrontrunner] ;
 
